<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            height: 200px;
            background: rgb(46, 197, 147);
        }
    </style>
</head>
<body>
    <div id="box"></div>

    <script>
        //获取元素
        let box = document.querySelector('#box');

        //绑定事件
        box.ontouchstart = function(e){
            box.innerHTML = '同时按下的触点: ' + e.changedTouches.length;
            box.innerHTML += '<br>事件源身上的触点: ' + e.targetTouches.length;
            box.innerHTML += '<br>屏幕上身上的触点: ' + e.touches.length;
            this.style.background = '#f66';
            //阻止默认行为
            e.preventDefault();
        }
        
        //触摸滑动事件
        box.ontouchmove = function(e){
            box.innerHTML = '同时滑动的触点: ' + e.changedTouches.length;
            box.innerHTML += '<br>事件源身上的触点: ' + e.targetTouches.length;
            box.innerHTML += '<br>屏幕上身上的触点: ' + e.touches.length;
            this.style.background = '#6f6'
        }

        //触摸结束事件
        box.ontouchend = function(e){
            box.innerHTML = '同时抬起的触点: ' + e.changedTouches.length;
            box.innerHTML += '<br>事件源身上的触点: ' + e.targetTouches.length;
            box.innerHTML += '<br>屏幕上身上的触点: ' + e.touches.length;
            this.style.background = '#56f'
        }
    </script>
</body>
</html>